  //左中 条形图
  $(document).ready(function() {
    function fetchDataAndUpdate(globalName) {
      $.get(`http://127.0.0.1:5000/task2/marketName=${globalName}`).done(function (data) {
        var myCharts = echarts.init(document.querySelector('.panel .bar2'))
        option = {
            "title": {
                "text": "水果所属科目",
                x: "center",
                y: "2%",
                textStyle: {
                    color: '#fff',
                    fontSize: '15'
                }
            },
            tooltip: {},
            animationDurationUpdate: 1500,
            animationEasingUpdate: 'quinticInOut',
            series: [
              {
                data: data.data,
                type: 'graph',
                layout: 'none',
                symbolSize: 40,
                roam: true,
                label: {
                  show: true,
                  fontSize: 11,
                },
                edgeSymbol: ['circle', 'arrow'],
                edgeSymbolSize: [4, 10],
                edgeLabel: {
                  fontSize: 15
                },
                lineStyle: {
                  opacity: 1,
                  width: 2,
                  curveness: 0.3,
                  color: "#faaebc"
                },
                links:data.links
              }
            ]
          };
        myCharts.setOption(option)
    })
    }
    fetchDataAndUpdate(window.globalName)
    $(document).on('globalNameChanged', function(event, globalName) {
      fetchDataAndUpdate(window.globalName)
  })
})